﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;



namespace is_it_messy
{
    class LongUnaccessFileReminding
    {
        private const double STANDAR = 30;

        public static List<FileData> reminding(String path)
        {
            List<FileData> datas = Util.GetFilesInfo(path);
            List<FileData> longUnaccessFiles = new List<FileData>();

            if(datas.Count != 0)
            {
                foreach (FileData data in datas)
                {
                    if (unaccessDays(data) > STANDAR)
                    {
                        longUnaccessFiles.Add(data); 
                    }
                }
            }
            return longUnaccessFiles;
        }

        private static double unaccessDays(FileData file)
        {
            DateTime lastAccessTime = file.LastWriteTime;
            DateTime currentTime= DateTime.Now;

            TimeSpan d3 = currentTime.Subtract(lastAccessTime);
            double unAccessDays = d3.TotalDays;

            return unAccessDays;
        }

    }
}
